<!--<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>-->
<head>
  <?php
PageUtil::addVar("javascript_body","<script type=\"text/javascript\" src=\"".$themepath."/framework/ckeditor/ckeditor.js\"></script>");
?>
<link rel="stylesheet" href="<?php echo $stylepath;?>/chosen.css">
<style type="text/css" media="all">
    /* fix rtl for demo */
    .chosen-rtl .chosen-drop { left: -9000px; }
  </style>
<style>
div.img
{
  margin: 5px;
  padding: 5px;
  border: 1px solid #0000ff;
  height: auto;
  width: auto;
  float: left;
  text-align: center;
} 
div.img img
{
  display: inline;
  margin: 5px;
  border: 1px solid #ffffff;
}
div.img a:hover img {border: 1px solid #0000ff;}
div.desc
{
  text-align: center;
  font-weight: normal;
  width: 120px;
  margin: 5px;
}
.ta3 {
  width:120px;
  height:60px;
  border:2px dashed #D1C7AC;
}
    #autoSuggestionsList > li {
         background: none repeat scroll 0 0 #F3F3F3;
         border-bottom: 1px solid #E3E3E3;
         list-style: none outside none;
         padding: 3px 15px 3px 15px;
         text-align: left;
    }
    #autoSuggestionsList > li a { color: #800000; }
    .auto_list {
         border: 1px solid #E3E3E3;
         border-radius: 5px 5px 5px 5px;
         position: absolute;
    }
</style>
</head>
<body>
<div class ="col-md-1"></div>
 <div class ="col-md-10">
<?php echo $map['js']; ?>
<section class="cat-widget wdg-cat-opposite clearfix">
  <div class="widget-title">
      <h3><a href="#">Add restaurant</a></h3>
      <span class="sub-title">เพิ่มร้านอาหาร</span>
      <div class="sep-widget"></div>
  </div>
  <section class="col-md-12">
  <form method="post" action="<?php echo base_url('restaurant/upload');?>" enctype="multipart/form-data">
      <div class="row">
      <div class="form-group">
        <div class="col-sm-3"></div>
        <!--<div class="col-sm-4">
          <img alt="Image Display Here" id="test" src="<?php echo $imagepath;?>/user.png" width="200px" height="200px"/>
          <input onchange="readURL(this);" type="file" />
        </div>-->
        </div>
      <?php if(!empty($resDetail["id"])){
        ?>
        <input type="hidden" class="form-control" name="id" value="<?php echo $resDetail["id"];?>">
        <?php
      }
      ?>
      </div>
      <div class="row">
      <div class="form-group">
        <label class="col-sm-2 control-label" for="username">ชื่อร้าน</label>
        <div class="col-sm-4">
          <input type="text" class="col-sm-4 form-control required" name="name" id="username" value="<?php if(!empty($resDetail["name"])){ echo $resDetail["name"]; }?>"/>
        </div>
      </div>
      </div><br/>
      <div class="row">
      <div class="form-group">
        <label class="col-sm-2 control-label" for="username">ความประทับใจ</label>
        <div class="col-sm-5">
          <input type="text" class="col-sm-5 form-control required" name="impression" id="username" value="<?php if(!empty($resDetail["impression"])){ echo $resDetail["impression"]; }?>"/>
        </div>
      </div>
      </div><br/>
      <div class="row">
      <div class="form-group">
        <label class="col-sm-2 control-label" for="address">รายละเอียด</label>
        <div class="col-sm-8">
          <textarea id="editor1" class="ckeditor" name="content"><?php if(!empty($resDetail["content"])){ echo $resDetail["content"]; }?></textarea>
        </div>
      </div>
      </div><br/>
              <!--<div class="row">
      <div class="form-group">
        <label class="col-sm-2 control-label">ประเภทรอง</label>
        <div class="col-sm-3">
       <?php foreach( $traList as $key=>$value) { ?>
            <label class="checkbox-inline">
            <input type="checkbox" name="tag[]" value="<?php echo $value['id']; ?>" id="gender[m]"><?php echo $value['name']; ?></label><br />
            <?php } ?>
        </div>
        </div>
      </div><br/>-->
    
      <div class="row">
      <div class="form-group">
        <label class="col-sm-2 control-label">เว็บไซต์</label>
        <div class="col-sm-5">
          <input type="text" class="col-sm-5 form-control required" name="url" id="url" value="<?php if(!empty($resDetail["url"])){ echo $resDetail["url"]; }?>">
        </div>
      </div>
      </div><br/>
      <div class="hidden">
        <?php 

          $dateTime = new DateTime('now', new DateTimeZone('Asia/Bangkok'));

        ?>
        <input type="text" class="col-sm-6 form-control required" name="comment_status" id="comment_status" value="1">
        <input type="text" class="col-sm-6 form-control required" name="update_date" id="update_date" value="<?php echo $dateTime->format('Y-m-d H:i:s');?>">
        <input type="text" class="col-sm-6 form-control required" name="view" id="view" value="1">
        <input type="text" class="col-sm-6 form-control required" name="cr_date" id="cr_date" value="<?php echo $dateTime->format('Y-m-d H:i:s');?>">
        <input type="text" class="col-sm-6 form-control required" name="lu_date" id="lu_date" value="<?php echo $dateTime->format('Y-m-d H:i:s');?>">
        <input type="text" class="col-sm-6 form-control required" name="lu-uid" id="lu-uid" value="1">
        <input type="text" class="col-sm-6 form-control required" name="comment_count" id="comment_count" value="1">
        
      </div>
      <div class="map col-md-offset-2">
        <?php echo $map['html']; ?>
      </div>
      <br />

      <!--textbox hidden add latutude longtitubd-->
      <div class="form-group hidden">
        <div class="col-sm-6 col-md-offset-2">
            <input type="text" class="col-sm-4 form-control required" name="lat" id="newLat" value="<?php if(!empty($resDetail["lat"])){ echo $resDetail["lat"]; }?>">
            <input type="text" class="col-sm-4 form-control required" name="lng" id="newLng" value="<?php if(!empty($resDetail["lng"])){ echo $resDetail["lng"]; }?>">
        </div>
      </div>
      <br />
      <hr/>
      <div class="row">
      <div class="form-group">
        <label class="col-sm-3 control-label">แท็กหลัก</label>
        <div class="col-sm-4">
        <select name="tagDefault" class="form-control">
        <?php foreach( $traList as $key=>$value) { ?>
        <option><?php echo $value['name']; ?></option>
       <?php } ?>
      </select>
      </div>
        <div class="col-sm-3">
           
        </div>
        </div>
      </div><br/>
      <div class="row">
      <div class="form-group">
      <label class="col-sm-3 control-label">แท็กอื่นๆ </label>
      <select data-placeholder="เลื่อกแท็ก" style="width:400px;" multiple class="chosen-select" tabindex="8" name="tag[]" >
            <option value=""></option>
            <?php foreach( $traList as $key=>$value) { ?>
            <option value="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></option>
            <?php } ?>
          </select>
          </div>
          </div><br/><hr/>
  <div class="row">
    <div class="col-sm-3">
      <div class="img">
        <a href="#">
          <img alt="Image Display Here" id="test1" src="<?php echo $imagepath;?>/t01.png" width="120px" height="120px"/>
        </a>
        <div class="desc"><textarea class="ta3" name="taxt1" placeholder="เพิ่มรายละเอียดรูปภาพที่นี..."></textarea></div>
      </div>
    </div>
    <div class="col-sm-3">
      <div class="img">
        <a href="#" >
          <img alt="Image Display Here" id="test2" src="<?php echo $imagepath;?>/t01.png" width="120px" height="120px"/>
        </a>
        <div class="desc"><textarea class="ta3" name="taxt2" placeholder="เพิ่มรายละเอียดรูปภาพที่นี่..."></textarea></div>
      </div>
    </div>
    <div class="col-sm-3">
      <div class="img">
        <a href="#">
          <img alt="Image Display Here" id="test3" src="<?php echo $imagepath;?>/t01.png" width="120px" height="120px"/>
        </a>
        <div class="desc"><textarea class="ta3" name="taxt3" placeholder="เพิ่มรายละเอียดรูปภาพที่นี่..."></textarea></div>
      </div>
    </div>
    <div class="col-sm-3">
      <div class="img">
        <a href="#">
          <img alt="Image Display Here" id="test4" src="<?php echo $imagepath;?>/t01.png" width="120px" height="120px"/>
        </a>
        <div class="desc"><textarea class="ta3" name="taxt4" placeholder="เพิ่มรายละเอียดรูปภาพที่นี่..."></textarea></div>
      </div>
    </div>
  </div>
  <div class="row">
    <div class="col-sm-3">
      <input  onchange="readURL1(this);" type="file" name="image1"  />
    </div>
    <div class="col-sm-3">
      <input  onchange="readURL2(this);" type="file" name="image2"  />
    </div>
    <div class="col-sm-3">
      <input  onchange="readURL3(this);" type="file" name="image3"  />
    </div>
    <div class="col-sm-3">
      <input  onchange="readURL4(this);" type="file" name="image4"  />
    </div>
  </div><hr/>
  <div class="form-group">
        <div class="col-sm-offset-5">
          <button type="submit" class="btn btn-primary" id="submitbtn" name="upload" value="upload">ยืนยัน</button>
          <a href="<?php echo base_url("admin/restaurant/");?>" class="btn btn-default">ยกเลิก</a>
        </div>
      </div>
  </form>
</section>
</section>
</div>
<div class ="col-md-1"></div>
</body>
  <script type="text/javascript">
    function addValue(newLat, newLng)
    {
      $('#newLat').val(newLat)
      $('#newLng').val(newLng)
    }
      
</script>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
  <script src="<?php echo $jspath;?>/chosen.jquery.js" type="text/javascript"></script>
  <script type="text/javascript">
    var config = {
      '.chosen-select'           : {},
      '.chosen-select-deselect'  : {allow_single_deselect:true},
      '.chosen-select-no-single' : {disable_search_threshold:10},
      '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
      '.chosen-select-width'     : {width:"95%"}
    }
    for (var selector in config) {
      $(selector).chosen(config[selector]);
    }
</script>
 